<template>
<div>
    <basic-container>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>产品配置</el-breadcrumb-item> 
        <el-breadcrumb-item>测试工具</el-breadcrumb-item>
        <el-breadcrumb-item>用户信息查询</el-breadcrumb-item>
      </el-breadcrumb>
    </basic-container>
    <basic-container>
    <el-form ref="form" :model="form" label-width="80px" class="demo-form-inline" :inline="true">
      <el-form-item label="用户id">
        <el-input v-model="form.user_id"></el-input>
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="form.phone"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>

    <div v-for="user in userList" :key="user" style="float:left;margin-right:20px; padding-bottom:50px">
        <h3>用户信息:
          <font v-if="user.is_delete==1" style="font-size:8px;color:red">已注销用户</font>
          <font v-if="user.is_delete==0" style="font-size:8px;color:red">正常用户</font>
           
        </h3>
        <b> <p style="font-size:8px">用户ID：{{user.user_id}}</p> </b>
        <b> <p style="font-size:8px">昵称：{{user.user_name}}</p> </b>
        <b> 
          <p style="font-size:8px">
            <font v-if="user.login_type==6">邮箱号：</font>
            <font v-else-if="user.login_type==5">Apple唯一id：</font>
            <font v-else-if="user.login_type==7">Google唯一id：</font>
            <font v-else-if="user.login_type==8">Facebook唯一id：</font>
            <font v-else >登录类型：<font style="color:red">游客</font></font>
            {{user.open_id}}
          </p> 
        </b>
        <b> <p style="font-size:8px">游客创建时间：{{user.reg_time}}</p> </b>
        <b> <p style="font-size:8px">登录id首次绑定时间：{{user.reg_version_time}}</p> </b>
        <b> <p style="font-size:8px">最后一次访问时间：{{user.last_req_time}}</p> </b>
        <b> <p style="font-size:8px">注册版本：{{user.userChannel==null?'':user.userChannel.reg_version}}</p> </b>
        <b> <p style="font-size:8px">当前版本：{{user.userChannel==null?'':user.userChannel.cur_version}}</p> </b>
        <b> <p style="font-size:8px">注册渠道ID：{{user.userChannel==null?'':user.userChannel.reg_channel_id}}</p> </b>
        <b> <p style="font-size:8px">渠道ID：{{user.userChannel==null?'':user.userChannel.channel_id}}</p> </b>
        <br>
        <b> <p style="font-size:8px">书币余额：{{user.userAccount==null?'':user.userAccount.coin_balance+user.userAccount.give_coin}}</p> </b>
        <b> <p style="font-size:8px">鱼摆摆余额：{{user.userAccount==null?'':user.userAccount.arch_balance}}</p> </b>
        <b> <p style="font-size:8px">分成账户余额：{{user.userAccount==null?'':user.userAccount.account_balance}}</p> </b>
        <b> <p style="font-size:8px">用户属性：{{user.identity==0?'普通用户':user.identity==1?'作者':user.identity==2?'插画师':user.identity==3?'作者/插画师':'我是个假用户'}}</p> </b>
        <br>
        <b>
          <p style="font-size: 8px">
            是否会员：{{
              user.userMember == null
                ? "不是"
                : Date.parse(new Date(user.userMember.end_time)) -
                    new Date().getTime() >
                  0
                ? "是"
                : "不是"
            }}
          </p>
        </b>
        <b> <p style="font-size:8px">会员到期时间：{{user.userMember==null?'':user.userMember.end_time}}</p> </b>
    </div>

</basic-container>
</div>
</template>
<script>
import { common } from "@/api/cat/httpRequest";
import { tools as baseURL } from "@/api/cat/baseUrls";
export default {
  data() {
    return {
      form: {},
      userList:{}
    };
  },
  methods: {
    async onSubmit() {
      let {data} = await common(baseURL.getUserInfo, this.form, null, "POST");
      if (data == null || data.length==0) {
        this.userList = []
        this.$message.error("用户不存在")
        return;
      }
      this.userList = data;
    },
  },
};
</script>